<?php

App::uses('AppController', 'Controller');

class WelcomeController extends AppController
{

    public function beforeFilter() {
        $this->Auth->allow();
        parent::beforeFilter();
    }

    public function index() {
        $this->request->allowMethod('get');
        $this->set('title', __('Bienvenido'));
        $this->layout = 'base';
    }

    public function associated() {
        $this->loadModel('Category');
        $this->loadModel('UserLine');
        $user = $this->Auth->user();
        $certs_trains = $this->UserLine->getLineCategorization($user['id']);
        $name = ucwords(strtolower($user['full_name']));
        $title = __('Bienvenido');
        if (isset($user['curp']['10']) && $user['curp']['10'] != 'H') {
            $title = __("Bienvenida");
        }
        $this->set('title', $title);
        $this->set('name', $name);
        $this->set('certs_trains', $certs_trains);
        $this->layout = 'base';
    }

}
